package com.shao.demo.feignconsumer.common.constans;

import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author zhiqi.shao
 * @Date 2018/5/23 16:21
 */
public enum StatusCode {
    SUCCESS(200, "成功"),
    FORBIDDEN(403, "权限失败"),
    CREATE_TOKEN_ERROR(999, "Token创建失败"),
    MISSING_REQUIRE_FIELD(1000, "参数缺失"),
    PARAMETER_VALUE_RANGE_ERROR(1001, "取值范围错误"),
    HTTP_RESPONSE_ERROR(1002, "调用外部请求时，发生http请求错误"),
    JSON_ANALYSIS_ERROR(1003, "调用外部请求时，发生json数据解析错误"),
    INTERNET_IO_ERROR(1004, "调用外部请求时，发生网络IO错误"),
    ERROR(500, "系统错误");

    private String message;
    private int code;

    private StatusCode(int statusCode, String statusMessage) {
        this.message = statusMessage;
        this.code = statusCode;
    }

    @JsonValue
    public String getStatusMessage() {
        return this.message;
    }

    public int getStatusCode() {
        return this.code;
    }
}
